#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''
@Author: Phoenix
@Date: 2020-07-04 23:33:35
'''

from sys import exit

import modules.translated_txt_lib as translated_txt_lib
import modules.json_translation as json_translation
import modules.rpgm_mz_extraction_writing as rpgm_mz_extraction_writing
import modules.rpgm_mv_extraction_writing as rpgm_mv_extraction_writing
import modules.rpgm_vx_ace_extraction_writing as rpgm_vx_ace_extraction_writing
import modules.renpy_translation as renpy_translation
import modules.renpy_txt_update as renpy_txt_update
import modules.single_txt_tranlsation as single_txt_tranlsation


def start_main(reselect='0', serial_num=''):
    if reselect == '0':
        print(
            r'''======================================================================
______  _____  _   _ ______ __   __      ______ ______  _____ ___  ___
| ___ \|  ___|| \ | || ___ \\ \ / /___   | ___ \| ___ \|  __ \|  \/  |
| |_/ /| |__  |  \| || |_/ / \ V /( _ )  | |_/ /| |_/ /| |  \/| .  . |
|    / |  __| | . ` ||  __/   \ / / _ \/\|    / |  __/ | | __ | |\/| |
| |\ \ | |___ | |\  || |      | || (_>  <| |\ \ | |    | |_\ \| |  | |
\_| \_|\____/ \_| \_/\_|      \_/ \___/\/\_| \_|\_|     \____/\_|  |_/

                            作者：Phoenix
                            版权归作者所有
======================================================================

1) Ren'Py 提取文本翻译
2) Ren'Py 提取文本更新
3) RPG Maker MZ 文本提取写入
4) RPG Maker MV 文本提取写入
5) RPG Maker VXAce 文本提取写入
6) JSON 文本翻译
7) 单语句翻译
8) rpy/json 写入译文库
0) 退出
'''
        )
        inp = input('请输入要操作的序号：').strip()

        if inp == '1':
            renpy_translation.start()
        elif inp == '2':
            renpy_txt_update.start()
        elif inp == '3':
            rpgm_mz_extraction_writing.start()
        elif inp == '4':
            rpgm_mv_extraction_writing.start()
        elif inp == '5':
            rpgm_vx_ace_extraction_writing.start()
        elif inp == '6':
            json_translation.start()
        elif inp == '7':
            single_txt_tranlsation.start()
        elif inp == '8':
            translated_txt_lib.start()
        elif inp == '0':
            exit(0)
        else:
            start_main('1', inp)
        return

    tmp = input(
        f'列表中不存在序号 {serial_num}，请重新输入正确序号或回车退出程序：'
    ).strip()
    if tmp == '':
        exit(0)

    if tmp == '1':
        renpy_translation.start()
    elif tmp == '2':
        renpy_txt_update.start()
    elif tmp == '3':
        rpgm_mz_extraction_writing.start()
    elif tmp == '4':
        rpgm_mv_extraction_writing.start()
    elif tmp == '5':
        rpgm_vx_ace_extraction_writing.start()
    elif tmp == '6':
        json_translation.start()
    elif tmp == '7':
        single_txt_tranlsation.start()
    elif tmp == '8':
        translated_txt_lib.start()
    elif tmp == '0':
        exit(0)
    else:
        start_main('1', tmp)


if __name__ == '__main__':
    start_main()
